package com.hex.ds.hdrs.period.job.dao;

import com.hex.bigdata.hbda.base.BaseDao;
import com.hex.bigdata.hbda.base.Page;
import com.hex.ds.hdrs.period.job.po.PeriodJob;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;


@Repository
public class PeriodJobDao extends BaseDao {

    /*
     * @Method: queryListByPage <br>
     * @Param: [periodJob, page] <br>
     * @Return: java.util.List<com.hex.ds.hdrs.period.job.po.PeriodJob> <br>
     * @Description：分页查询<br>
     * @Author： wz.li<br>
     * @Date： 2023/5/4 11:07 <br>
     * @Version： V2.0.2<br>
     */
    public List<PeriodJob> queryListByPage(PeriodJob periodJob, Page page) {
        return this.selectPage(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.queryListByPage", page, periodJob);
    }

    /*
     * @Method: queryOne <br>
     * @Param: [periodJob] <br>
     * @Return: com.hex.ds.hdrs.period.job.po.PeriodJob <br>
     * @Description：查询指定作业实例对象<br>
     * @Author： wz.li<br>
     * @Date： 2023/5/4 14:00 <br>
     * @Version： V2.0.2<br>
     */
    public PeriodJob queryOne(PeriodJob periodJob) {
        return this.selectOne(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.queryOne", periodJob);
    }

    /*
     * @Method: queryList <br>
     * @Param: [periodJob] <br>
     * @Return: java.util.List<com.hex.ds.hdrs.period.job.po.PeriodJob> <br>
     * @Description：列表查询-不分页<br>
     * @Author： wz.li<br>
     * @Date： 2023/5/5 10:59 <br>
     * @Version： V2.0.2<br>
     */
    public List<PeriodJob> queryList(PeriodJob periodJob){
        return this.selectList(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.queryList", periodJob);
    }

    public void updateJob(Map map) {
        this.update("com.hex.ds.hdrs.period.job.dao.PeriodJobDao.updateByMap", map);
    }

    public List<PeriodJob> qryLstFnsJobList(String lastQryTs) {
        return this.selectList(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.qryLstFnsJobList", lastQryTs);
    }

    public List<PeriodJob> qryLstFnsJobList() {
        return this.selectList(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.qryLstFnsJobList");
    }

    public List<PeriodJob> qryJobList(String lastQryTs) {
        return this.selectList(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.qryJobList", lastQryTs);
    }

    public List<PeriodJob> qryJobList() {
        return this.selectList(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.qryJobList");
    }

    public int insert(PeriodJob periodJob) {
        return this.insert("com.hex.ds.hdrs.period.job.dao.PeriodJobDao.insert", periodJob);
    }

    public int delJobInfo(List<String> list) {
        return this.delete("com.hex.ds.hdrs.period.job.dao.PeriodJobDao.deljobs", list);
    }

    public int batchUpdateJobBizDate(Map map) {
        return this.update("com.hex.ds.hdrs.period.job.dao.PeriodJobDao.batchUpdateJobBizDate", map);
    }

    public List<PeriodJob> qryJobLike(Map map) {
        return this.selectList(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.qryJobLike", map);
    }

    public List<Map> countGroupByStatus(Map map) {
        return this.selectList(Map.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.countGroupByStatus", map);
    }

    public PeriodJob getNextPeriodJob(Map map) {
        return this.selectOne(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.getNextPeriodJob", map);
    }

    public int upDependJobCount(Map map) {
        return this.selectOne(Integer.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.upDependJobCount", map);
    }

    public List<PeriodJob> queryUpDependJob(Map map){
        return this.selectList(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.queryUpDependJob", map);
    }

    public int upDependJobCountNoStatus(Map map) {
        return this.selectOne(Integer.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.upDependJobCountNoStatus", map);
    }

    public void delJobByDate(Map map) {
        this.delete("com.hex.ds.hdrs.period.job.dao.PeriodJobDao.delJobByDate", map);
    }

    public void reductionJob(String bitchId) {
        this.insert("com.hex.ds.hdrs.period.job.dao.PeriodJobDao.reductionJob", bitchId);
    }

    public List<PeriodJob> qryJobDoingButAllTaskFinished() {
        return this.selectList(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.qryJobDoingButAllTaskFinished", null);
    }

    public List<PeriodJob> qryAllTaskHandSuccessJobNotSuccess(){
        return this.selectList(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.qryAllTaskHandSuccessJobNotSuccess", null);
    }

    public List<PeriodJob> qryFailJobInNoTaskFail() {
        return this.selectList(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.qryFailJobInNoTaskFail", null);
    }

    public List<PeriodJob> updatePeriodJobByBizDate(Map map){
        return this.selectList(PeriodJob.class, "com.hex.ds.hdrs.period.job.dao.PeriodJobDao.updatePeriodJobByBizDate", map);
    }
}